<script setup lang="ts">
import { inject, onMounted, ref,onBeforeMount } from 'vue'
import { useMainStore } from "@/store"
const mainStore = useMainStore()
const count = ref(0)


defineProps<{ msg: string }>()
import axios from "axios";

import { info,mockTest } from "@/api"
import { useRoute } from "vue-router"
const route = useRoute();
 
let loading = ref<boolean>(false);
let sidebar = ref<any>({});
 
const _fetch = async (): Promise<void> => {
    const routeName = route.name as string;
    const path = '/upms/user/info'
    try {
        loading.value = true;
        // const res = await info({ path, routeName });
        // if (!res || !res.data) return;
        // sidebar.value = res.data;
        // console.log(sidebar.value);
      // console.log(res);
        const res = await mockTest()
        console.log(res);
    } finally {
        loading.value = false
    }
}
 
onBeforeMount(() => {
  _fetch()
  // //get请求
  // axios.get("/upms/user/info").then((res) => {
  //   console.log("get请求返回的数据", res);
  // });

})
</script>

<template>
  
  <h1>123</h1>
  <h1>{{ msg }}</h1>
  <h1>{{ mainStore.info}}</h1>
  <div class="card">
    <button type="button" @click="count++">count is {{ count }}</button>
    <p>
      Edit
      <code>components/HelloWorld.vue</code> to test HMR
    </p>
  </div>

  <p>
    Check out
    <a href="https://vuejs.org/guide/quick-start.html#local" target="_blank"
      >create-vue</a
    >, the official Vue + Vite starter
  </p>
  <p>
    Install
    <a href="https://github.com/vuejs/language-tools" target="_blank">Volar</a>
    in your IDE for a better DX
  </p>
  <p class="read-the-docs">Click on the Vite and Vue logos to learn more</p>
</template>

<style scoped>
.read-the-docs {
  color: #888;
}
</style>
